import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.0
//import QtQuick.Window 2.0

Rectangle {
    property int getting_width: 800
    property int getting_height: 480
    property string bg_color: "darkgrey"
    property string tf_text_color: "#303030"
    property string bg_sell: "grey"
    property string brd_sell: "white"
    property string text_sell: "#303030"
    signal goSeeItems
    width: getting_width
    height: getting_height

    Rectangle
    {
        id:bacground
        x: 0
        y: 113
        width: getting_width
        height:getting_height
        anchors.centerIn: parent
        color:bg_color
    }
    Component {
        id: delegate
        Rectangle {
            width: getting_width
            height: 50
            color:bg_sell
            border.color:brd_sell

            Text
            {
                anchors.left: parent.left
                anchors.leftMargin: 15
                anchors.verticalCenter: parent.verticalCenter
                text:(name != "+")?"x":""
                MouseArea
                {
                    anchors.fill: parent
                    onClicked:
                    {
                        C_model.remColl(name)
                    }
                }

            }

            Text
            {
                anchors.right: parent.right
                anchors.rightMargin: 15
                anchors.verticalCenter: parent.verticalCenter
                text:(name != "+")?"ok":""
                MouseArea
                {
                    anchors.fill: parent
                    onClicked:
                    {
                        C_model.chosen(name)
                        goSeeItems()

                    }
                }

            }
            Text
            {
                x: 5
                text: "This is Collection "+name
                font.pointSize: 30
                anchors.horizontalCenter: parent.horizontalCenter
                anchors.verticalCenter: parent.verticalCenter
                color: text_sell
                MouseArea
                {
                    anchors.fill: parent
                    onClicked:
                    {
                        console.log(name)
                        if (name === "+")
                        {
                            C_model.addColl("f"+(index+1))
                        }
                    }
                }
            }
        }
    }
    GridView {
        id: grid_view1
        width: getting_width
        height: getting_height
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.verticalCenter: parent.verticalCenter
        cellWidth: 800
        cellHeight: 60
        focus: true      
        model: C_model
        delegate: delegate
    }

}
